import java.awt.Graphics;

/**
 * project5
 * 
 * brief description of the program
 * 
 * This program is released to public domain according to author's wish, you can
 * view full license at http://tomatoeskit.org/upload/PublicDomainLicense.txt
 * 
 * @author Fangning CHENG (Alpha.L Cheng) <chengf@purdue.edu>
 * 
 * @lab section number
 * 
 * @date Oct 21, 2013
 * 
 */

public class Triangle implements Shape {
    private int centerX;
    private int centerY;
    private int radius;
    private final int rs60;
    private final int rc60;

    Triangle(int cX, int cY, int r) {
        centerX = cX;
        centerY = cY;
        radius = r;
        rs60 = (int) (r * (Math.sqrt(3) / 2));
        rc60 = r / 2;
    }

    public void draw(Graphics g) {
        int x[] = new int[] {centerX - rs60, centerX, centerX + rs60};
        int y[] = new int[] {centerY + rc60, centerY - radius, centerY + rc60};
        g.drawPolygon(x, y, 3);
    }
}
